<?php

include_once("php/product.php");
include_once("php/category.php");

if($_POST["object"] == "category")
{
	$cat = New Category();

	if( $_POST["id"] == "none")
		$cat->id = NULL;
	else
		$cat->id = $_POST["id"];

	$cat->name = $_POST["name"];
	$cat->parent_id = $_POST["parent_id"];
	$cat->save();

	unset($cat);
}

?>
<html>
<body>
	<a href="admin-category.php">Category</a>
	<a href="admin-attribut.php">Attribut</a>
	<a href="admin-product.php">Product</a>
	<hr />
	<h3>category</h3><br />
	<form name="category" method="post" action="admin.php">
		<input type="hidden" name="object" value="category" />
		<input type="hidden" name="id" value="none" />
		<table>
			<tr>
				<td>Name:</td>
				<td><input type="text" name="name"></td>
			</tr>
			<tr>
				<td>Parent Category:</td>
				<td>
					<select name="parant_id">
						<option value="none">none</option>
						<?php
						print("<option value='id'>Name</option>");
						?>
					</select>
			</tr>
			<tr>
				<td></td>
				<td><input type="button" name="button" value="save"></td>
			</tr>

		</table>
	</form>

	<hr />
	
	<h3>attribut</h3>

	<form name="attribut">
		<table>
			<tr>
				<td>Name:</td>
				<td><input type="text"></td>
			</tr>
			<tr>
				<td>Type:</td>
				<td>
					<select name="type">
						<option name="integer">integer</option>
						<option name="float">float</option>
						<option name="text">text</option>
					</select>
				</td>
			</tr>
			<tr>
				<td>Unit:</td>
				<td>
					<select name="type">
						<option value="-new-">-new-</option>
					</select>
				</td>
				<td><input type="text" name="newtype"></td>
			</tr>
			<tr>
				<td></td>
				<td><input type="button" name="save" value="save"></td>
			</tr>
		<table>
	</form>

</body>
</html>
